<uieip type="page" value="base"></uieip>
<uieip type="reg" value="console"></uieip>
<html lang="zh">

<head>
  <uieip type="file" value="inc" src="/jsvm/inc/head.html"></uieip>
  <title>yuanqi.jsvm</title>
  <meta name="keywords" content="yuanqi ltd.">
</head>

<body>
  <uieip type="file" value="exec" src="/jsvm/inc/title_exec.html"></uieip>
  <div class="container">
    <h1>yuanqi.jsvm</h1>
    <ul>
      <li>--error--</li>
      <li><a href="error/format_uieip1.html">uieip1 error</a></li>
      <li><a href="error/format_script1.html">script1 error</a></li>
      <li><a href="error/format_script2.html">script2 error</a></li>
      <li><a href="error/code_error.html">code error</a></li>
      <li>--3.file--</li>
      <li><a href="file/inc.html">file-inc</a></li>
      <li><a href="file/exec.html">file-exec</a></li>
      <li><a href="file/jscss.html">file-js&css</a></li>
      <li><a href="file/jsvm.html">file-jsvm</a></li>
      <li>--4.tmpl--</li>
      <li><a href="tmpl/tmpl.base.html">tmpl.base</a></li>
      <li>--5.form--</li>
      <li><a href="form/demo1.html">demo1</a></li>
      <li>--8.程序快--</li>
      <li><a href="include/incjs.html">include</a></li>
      <li>--9.赋值--</li>
      <li><a href="response/demo1.html">demo1</a></li>
     
      <li>--脚本函数--</li>
      <li><a href="func/model.html">model</a></li>
    </ul>
  </div>
  <uieip type="file" value="inc" src="/jsvm/inc/foot.html"></uieip>
  <script>
    $(function () {
      if (typeof _tmp_cms_nav == "object") {
       console.log( $(".navbar-collapse>ul").length);
        var $uls=$(".navbar-collapse>ul");
        var $ul= $($uls[1]);
        $uls[0].remove();

        var menuhtml=bootstrap(_tmp_cms_nav);
        $ul.before(menuhtml);

        console.log(menuhtml);
      }
    });

    function bootstrap(res) {
      var h = bootstrap_html(res.navs, res.path, true);
      return h;
    }

    function bootstrap_html(navs, path, root) {
      if (navs.length == 0) {
        return "";
      }

      var h = '';
      if (root) {
        h += '<ul class="nav navbar-nav">';
        h += '   <li class="nav-item' + (path == "" ? " active" : "") + '">';
        h += '      <a class="nav-link' + (path == "" ? " active" : "") + '" href="' + (path == "" ? "javascript:void(0);" : "/") + '">首页</a>';
        h += '   </li>';
      } else {
        h += '<ul class="dropdown-menu">';
      }

      for (var i = 0; i < navs.length; i++) {
        var nav = navs[i];

        if (!nav.IsDel) {
          var s_h = bootstrap_html(((nav.Subs === undefined || nav.Subs === null) ? [] : nav.Subs), path, false);
          var href = "";
          if (nav.LinkUrl != "") {
            if (!(nav.LinkUrl.substring(0, 7) == "http://" || nav.LinkUrl.substring(0, 8) == "https://")) {
              if (nav.LinkUrl == path) {
                href = "javascript:void(0);";
              } else {
                href = "/" + nav.LinkUrl + "/";
              }
            } else {
              href = nav.LinkUrl;
            }
          } else {
            if (nav.Path == path) {
              href = "javascript:void(0);";
            } else {
              href = "/" + nav.Path + "/";
            }
          }

          if (s_h == "") {
            var active = (path == nav.Path) ? true : false;
            h += '   <li class="nav-item' + (active ? " active" : "") + '">';
            h += '       <a class="nav-link' + (active ? " active" : "") + '" href="' + href + '"' + (nav.Blank ? ' target="_blank"' : '') + '">' + nav.Name + '</a>';
            h += '   </li>';
          } else {
            var active = s_h.indexOf(" active") > 0 ? true : false;
            h += '   <li class="nav-item dropdown' + (active ? " active" : "") + '">';
            h += '      <a class="nav-link dropdown-toggle' + (active ? " active" : "") + '" data-bs-toggle="dropdown" href="' + href + '"' + (nav.Blank ? ' target="_blank"' : '') + ' role="button" aria-expanded="false">' + nav.Name + '<b class="caret"></b></a>';
            h += s_h;
            h += '   </li>';
          }
        }
      }
      h += "</ul>"

      return h
    }
  </script>

</body>

</html>